package com.colin.aiyi.dao.ImpTest;

import com.colin.aiyi.entity.DataEntity;
import com.colin.aiyi.dao.ImpxUtils3_de.AbsService;
import com.colin.aiyi.entity.YiJuAndYiShuoEntity;
import com.colin.aiyi.entity.response.YiJuAndYiShuoResponse;
import com.colin.aiyi.presenter.Interface.Callback;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hl on 2017/5/8.
 */

public class ImpWordTest extends AbsService<YiJuAndYiShuoResponse> {

    @Override
    public void getT(Callback<YiJuAndYiShuoResponse> callback) {
        super.getT(callback);
//        callback.onSuccess(initTestData());
        initTestData();
    }

    @Override
    public void getAllT(Callback<YiJuAndYiShuoResponse> callback) {
        super.getAllT(callback);
        callback.onSuccess(getAllT());
    }

    @Override
    public void getAllT(Callback<YiJuAndYiShuoResponse> callback, String... type) {
        super.getAllT(callback,type);
       getAllT(callback);
    }



    public void initTestData(){
        new Thread(){
            @Override
            public void run() {
                List<YiJuAndYiShuoEntity> list=new ArrayList<>();
                for (int i = 0; i < 10; i++) {
                    YiJuAndYiShuoEntity entity=new YiJuAndYiShuoEntity();
                    entity.setContent("第"+i+"项内容测试");
                    if (i%2==0){
                        entity.setIsFree(false);
                        entity.setPictureUrl("http://7xi6i4.com1.z0.glb.clouddn.com/test%20%281%29.jpg");
                        entity.setUrl("http://7xi6i4.com1.z0.glb.clouddn.com/test%20%281%29.jpg");
                        entity.setVoiceUrl("http://opf1eamsp.bkt.clouddn.com/%E5%90%8E%E6%9D%A5%20-%20%E5%88%98%E8%8B%A5%E8%8B%B1.mp3");
                    }
                    list.add(entity);
                }
                DataEntity dataEntity=new DataEntity();
                dataEntity.setCount(10);
                dataEntity.setItems(list);
                YiJuAndYiShuoResponse  response=new YiJuAndYiShuoResponse();
                response.setCode(200);
                response.setData(dataEntity);
                callback.onSuccess(response);
            }
        }.start();
    }




}
